import Big from 'big.js'

const columns = () => {
  const cols = [
    {
      left: 40,
      title: '日期',
      dataIndex: 'time',
      width: '16%',
      headerAlign: 'left',
      bodyAlign: 'left',
    },
    {
      title: (
        <div className="inline-flex items-center">
          <span>总佣金</span>
          <span className="text-main-aa">{'（金额/订单数）'}</span>
        </div>
      ),
      width: '21%',
      render: (row) => {
        return `￥${Big(row.total?.amount || 0)
          .div(100)
          .toFixed(2)
          .toString()} / ${row.total?.orderCount}`
      },
    },
    {
      title: (
        <div className="inline-flex items-center">
          <span>有效佣金</span>
          <span className="text-main-aa">{'（金额/订单数）'}</span>
        </div>
      ),
      width: '21%',
      render: (row) => {
        return `￥${Big(row.effective?.amount || 0)
          .div(100)
          .toFixed(2)
          .toString()} / ${row.effective?.orderCount}`
      },
    },
    {
      title: (
        <div className="inline-flex items-center">
          <span>审核中佣金</span>
          <span className="text-main-aa">{'（金额/订单数）'}</span>
        </div>
      ),
      width: '21%',
      render: (row) => {
        return `￥${Big(row.audit?.amount || 0)
          .div(100)
          .toFixed(2)
          .toString()} / ${row.audit?.orderCount}`
      },
    },
    {
      title: (
        <div className="inline-flex items-center">
          <span>失效佣金</span>
          <span className="text-main-aa">{'（金额/订单数）'}</span>
        </div>
      ),
      width: '21%',
      render: (row) => {
        return `￥${Big(row.invalid?.amount || 0)
          .div(100)
          .toFixed(2)
          .toString()} / ${row.invalid?.orderCount}`
      },
    },
  ]
  return cols
}

export default columns
